package com.cxhc.cockpit;


import com.cxhc.common.annotation.Anonymous;
import com.cxhc.common.core.domain.R;
import com.cxhc.system.service.ISysUserService;
import lombok.SneakyThrows;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;


/**
 * 用户
 */
@RestController()
@RequestMapping("/cockpit/sysUser")
@CrossOrigin(origins = "*", maxAge = 3600)
public class ApiSysUser {

    @Resource
    private ISysUserService sysUserService;

    /**
     * 统计日期到今天 每天的增加用户量
     */
    @Anonymous
    @SneakyThrows
    @RequestMapping("/queryUserCountByDate")
    public R<List<Map<String,Integer>>> queryUserCountByCount(String date) {
        return R.ok(sysUserService.selectUserByDate(date));
    }

    /**
     * 统计用户数量
     */
    @Anonymous
    @SneakyThrows
    @RequestMapping("/queryUserCount")
    public R<Integer> queryUserCount(String date) {
        return R.ok(sysUserService.selectUserCount(date));
    }

}
